<!-- 全局组件-文章频道 -->
<template>
  <el-form-item label="频道">
    <el-select  placeholder="请选择频道" :value="value" @change="change">
      <el-option v-for="val in channels" :key="val.id" :label="val.name" :value="val.id"></el-option>
    </el-select>
  </el-form-item>
</template>

<script>
export default {
  props: ['value'],
  data: function () {
    return {
      channels: []
    }
  },
  mounted () {
    this.channelsFn()
  },
  methods: {
    channelsFn: async function () {
      const res = await this.$axios.get('/mp/v1_0/channels')
      this.channels = res.data.data.channels
    },
    change: function (a) {
      this.$emit('input', a)
    }
  }
}
</script>

<style scoped>

</style>
